<?php

class Application_Model_Transa extends Application_Model_DomainObject {

      protected $_id;
      protected $_companyID;
      protected $_transationCS;
      protected $_datetime;
      protected $_operator;

      public static function getFilter($name, $pagesize, $pageindex) {
            $where = array();
            if ($name != null) {
                  $where[" companyID like "] = "%" . $name . "%";
            }
            return Application_Model_Transa::getDao()->queryPage($where, 'id desc', $pagesize, $pageindex);
      }

      public static function getbycs($transationCS) {
            $where = array();
            if ($transationCS != null) {
                  $where["  transationCS = "] = $transationCS;
            }
            return Application_Model_Transa::getDao()->queryOne($where);
      }

      public function setOne() {
            $arrone = explode("<br />", $this->_transationCS);
            $test = 2;
            for ($index = 0; $index < count($arrone); $index++) {
                  if ($arrone[$index]) {
                        $name = $arrone[$index];
                        $transalist = new Application_Model_Transalist;
                        $result = Application_Model_Transalist::getbydingdan($name);
                        if (!$result) {
                              $transalist->listId = $this->_companyID;
                              $transalist->num = $name;
                              $transalist->count = $this->_id;
                              $transalist->save();
                              $test = 1;
                        }
                  }
            }
            return($test);
      }

      public static function getshiptype($companyID) {
            return Application_Model_shipType::load($companyID);
      }

}
